package com.hu.common.exception;

import com.hu.common.enums.BaseResultCodeEnum;

/**
 * @Author: zyz
 * @Date: 2023/7/17
 * @Version 1.0
 */
public class NewBizException extends RuntimeException {
    private final Integer code;
    private final String msg;

    public NewBizException(IResultCode iResultCode) {
        super(iResultCode.getCode() + iResultCode.getMessage());
        this.code = iResultCode.getCode();
        this.msg = iResultCode.getMessage();
    }

    public NewBizException(Integer code, String message) {
        super(code + message);
        this.code = code;
        this.msg = message;
    }

    public NewBizException(String message) {
        super(message);
        this.code = BaseResultCodeEnum.BIZ_ERROR.getCode();
        this.msg = message;
    }


    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
